$(function(){
	$(".mc").css("display","none");
	$('#categorys').hover(function(){
		$(this).children('.mc').toggle();
	});
	$Base.isLogin(location.href, getPointList);
	getMemberInfo();
});

function getMemberInfo(){
	var url = '/json?action=GET_T_MEMBER_POINT_ACTION';
	$.post(url,{},function(data){
		if(data.success){
			var obj  = data.root.T_MEMBER.rs[0];
			$('#AVAILABLE_POINTS').html(obj.AVAILABLE_POINTS);
		}
	},'json');
}

function getPointList() {
	var url = '/json?action=QUERY_T_POINTS_CHANGEBY_PAGER_ACTION';
	var pageSize = 10;
	var defaultHtml = '<tr><td colspan="5">您还没有未获得任何积分...</td></tr>';
	var current = $Util.getQueryString(document.location.search,'current');
	$UI.changePage(url,pageSize,'T_POINTS_CHANGE','#point_list',printPoint,'#pager',defaultHtml,current,'#topPagePanel');
}

function printPoint(obj,result,i,n,len,c,t) {
	if (t) {
		$('#totalProducts').html('共<strong>'+t+'</strong>个商品');
		$('#pageShow').html(c+'/'+(Math.floor(t/25)+1));
	}
	var html = '';
	html +=	'<tr>';
		if(obj.POINT_CHANGE_TYPE == 1 && obj.POINT_CHANGE_ITEM == 10){
	html +=		'<td>订单<a href="order_detail.html?id='+obj.POINT_CHANGE_DETAILS+'" target="_blank">'+obj.POINT_CHANGE_DETAILS+'</a></td>';		
		} else if(obj.POINT_CHANGE_TYPE == 1 && obj.POINT_CHANGE_ITEM == 11){
	html +=		'<td>'+obj.POINT_CHANGE_DETAILS+'</td>';				
		}
	
	html +=		'<td>'+obj.REMARKS+'</td>';
	html +=		'<td>'+obj.POINTS+'</td>';
	html +=		'<td>'+$Base.getPointItem(obj.POINT_CHANGE_ITEM)+'</td>';
	html +=		'<td>'+$Util.toChar(obj.CHANGE_DATE,'yyyy-mm-dd')+'</td>';
	html +=	'</tr>';
	$(result).append(html);
}